package com.smarth.zhizulian.utils.listhelper.impl.adapter;

import android.content.Context;

import com.smarth.zhizulian.adapter.BaseObjectListAdapter;
import com.smarth.zhizulian.utils.listhelper.inter.IDataAdapter;

import java.util.List;

/**
 * Created by 18865 on 2018/1/16.
 */

public abstract class ListDataAdapter<T extends List> extends BaseObjectListAdapter implements IDataAdapter<T> {
    public ListDataAdapter(Context context, List<?> datas) {
        super(context, datas);
    }

    @Override
    public void onGetData(T profitProfits, boolean isRefresh) {
        if (isRefresh) {
            mDatas.clear();
        }
        mDatas.addAll(profitProfits);
        notifyDataSetChanged();
    }

    @Override
    public boolean isDataEmpty() {
        return mDatas == null || mDatas.size() == 0;
    }

    @Override
    public T getMyData() {
        return (T) mDatas;
    }
}
